/**
 *  组合模式基类
 */
var Component = Class.extend({
    init : function() {
        this.childs = [];
    },

    addChild : function(o) {
        this.childs.push(o);
    },

    getChilds : function() {
        return this.childs;
    },

    /**
     * 清空this.childs
     */
    cleanChilds : function() {
        this.childs = [];
    },

    run : function(cmd) {
        $.each(this.getChilds(), function(k, v) {
            if (typeof(v[cmd]) != 'undefined') {
                v[cmd]();
            }
        })
    }
});
